var myModule = angular.module("myModule",[]);

myModule.controller("MyCtrl",["$scope",function($scope){
    $scope.sayHello = function (name) {
        alert("Hello " + name);
    }
}]);

myModule.directive("greeting",function () {
   return{
       restrict:"AE",
       scope:{
           greet:"&"
       },
       template:'<input type="text" ng-model="userName"/><br>' +
                '<button class="btn btn-default" ng-click="greet({name:userName})" >Greet</button><br>'
   }
});